package com.cn.wanxi.service.impl;

import com.cn.wanxi.dao.INewsDao;
import com.cn.wanxi.dao.impl.NewsDaoImpl;
import com.cn.wanxi.model.NewsModel;
import com.cn.wanxi.service.INewsService;

import java.util.List;

public class NewsServiceImpl implements INewsService {
    INewsDao newsDao = new NewsDaoImpl();
    @Override
    public int addNews(NewsModel newsModel) {
        return newsDao.addNews(newsModel);
    }

    @Override
    public int deleteNews(int id) {
        return newsDao.deleteNews(id);
    }

    @Override
    public int editNews(NewsModel newsModel) {
        return newsDao.editNews(newsModel);
    }

    @Override
    public List<NewsModel> getNewsList() {
        return newsDao.getNewsList();
    }

    @Override
    public NewsModel getNews(int id) {
        return newsDao.getNews(id);
    }

    @Override
    public List<NewsModel> getNewsList(int page, int size) {
        return newsDao.getNewsList(page,size);
    }

    @Override
    public List<NewsModel> getNewsList(int page, int size, String sort) {
        return newsDao.getNewsList(page, size, sort);
    }

    @Override
    public List<NewsModel> searchNews(String sql) {
        return newsDao.searchNews(sql);
    }

    @Override
    public long getNewsCount() {
        return newsDao.getNewsCount();
    }
}
